// 头像上传
var imgJson = {};
var attachDataId = null;
function uploadPer(dataId, type) {
    if ($("#uploadImg").html() == "删除图片") {
        //删除图片
        $("#headerInfo img").attr("src", "");
        $("#uploadImg").html("上传图片");
        uploadDel (null, imgJson.fileName, type);
        return;
    } else {
        uploadFile(type, "img", 1);
    }
}

//附件回调
function uploadCallback(data) {
    imgJson = data;
    imgJson['dataId'] = attachDataId;
    $("#headerInfo img").attr("src", data.filePath);
    $("#uploadImg").html("删除图片");
    baseAttachmentJson.push(imgJson);
    layer.closeAll();
}

//初始化头像信息
function initHeadImg(id, category) {
    This.jqueryAjax(Api.common.getAttachmentPhoto, {id: id, category: category}, "json", function (data) {
        if (data && data.length > 0) {
            if (data[0].filePath) {
                $("#headerInfo img").attr("src", data[0].filePath);
                $("#uploadImg").html("删除图片");
                imgJson = data[0];
                baseAttachmentJson.push(imgJson);
            }
        }
    });
}